<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>API 详情</title>


    <link rel="shortcut icon" href="favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/css/jsonFormater.css" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row panel panel-info">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title" style="border-style: none none none;">
                        <h5 th:text="${api.name}"></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>


                        </div>
                    </div>


                    <div class="ibox-content">
                        <h5>说明： <span th:text="${api.description}">获取用户信息时调用接口，此接口废弃</span></h5>
                        <hr>

                        <h5 >请求地址: <span th:text="${api.request.requestUri}">http://www.baidu.com</span></h5>


                        <hr>

                        <h5>请求参数</h5>

                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                            <tr>
                                <th>变量</th>
                                <th>类型</th>
                                <th>是否必填</th>
                                <th>说明</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="requestParam:${api.request.requestParamList}">
                                <td th:utext="${requestParam.fieldName}"></td>
                                <td th:text="${requestParam.type}"></td>
                                <td th:if="${requestParam.required}" th:text="是"></td>
                                <td th:if="${!requestParam.required}" th:text="否"></td>
                                <td th:text="${requestParam.description}"></td>
                            </tr>
                            </tbody>
                        </table>

                        <hr>
                        请求示例：

                        <pre id="request_json" style="height:80px;overflow:auto; display: none"  th:text="${api.request.requestExampleJson}">

                         </pre>


                        <div id="ControlsRow">
                            <input type="Button" value="格式化" id='format'/>
                            <span id="TabSizeHolder">
						缩进量
						<select id="TabSize">
							<option value="1">1</option>
							<option value="2" selected>2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>
							<option value="6">6</option>
						</select>
					  </span>
                            <input type="checkbox" id="QuoteKeys" checked='checked' />
                            <label for="QuoteKeys">
                                引号
                            </label>&nbsp;
                            <input type="checkbox" id="CollapsibleView" checked='checked' />
                            <label for="CollapsibleView">
                                显示控制
                            </label>
                            <span id="CollapsibleViewDetail">
								<a href="javascript:void(0);" id="expandAll">展开</a>
								<a href="javascript:void(0);" id="collapseAll">叠起</a>
								<a href="javascript:void(0);" class="expand" data-level="3">2级</a>
								<a href="javascript:void(0);" class="expand" data-level="4">3级</a>
								<a href="javascript:void(0);" class="expand" data-level="5">4级</a>
								<a href="javascript:void(0);" class="expand" data-level="6">5级</a>
								<a href="javascript:void(0);" class="expand" data-level="7">6级</a>
								<a href="javascript:void(0);" class="expand" data-level="8">7级</a>
								<a href="javascript:void(0);" class="expand" data-level="9">8级</a>
  							</span>
                        </div>


                        <div id="Canvas" class="Canvas"></div>


                    </div>
                </div>
            </div>
        </div>
        <div class="row panel panel-info">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title"  style="border-style: none none none;">
                        <h5>响应</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>

                        </div>
                    </div>
                    <div class="ibox-content">


                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                            <tr>
                                <th>变量</th>
                                <th>类型</th>
                                <th>是否返回</th>
                                <th>说明</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="responseParam:${api.response.responseParamList}">
                                <td th:utext="${responseParam.fieldName}"></td>
                                <td th:text="${responseParam.type}"></td>
                                <td th:if="${responseParam.required}" th:text="是"></td>
                                <td th:if="${!responseParam.required}" th:text="否"></td>
                                <td th:text="${responseParam.description}"></td>
                            </tr>

                            </tbody>
                        </table>
                        <hr>
                        响应示例：

                        <pre style="height:300px;overflow:auto; display: none" id="response_json" th:text="${api.response.responseExampleJson}">


                        </pre>


                        <div id="ControlsRowResponse">
                            <input type="Button" value="格式化" id='formatResponse'/>
                            <span id="TabSizeHolderResponse">
						缩进量
						<select id="TabSizeResponse">
							<option value="1">1</option>
							<option value="2" selected>2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>
							<option value="6">6</option>
						</select>
					  </span>
                            <input type="checkbox" id="QuoteKeysResponse" checked='checked' />
                            <label for="QuoteKeys">
                                引号
                            </label>&nbsp;
                            <input type="checkbox" id="CollapsibleViewResponse" checked='checked' />
                            <label for="CollapsibleView">
                                显示控制
                            </label>
                            <span id="CollapsibleViewDetailResponse">
								<a href="javascript:void(0);" id="expandAllResponse">展开</a>
								<a href="javascript:void(0);" id="collapseAllResponse">叠起</a>
								<a href="javascript:void(0);" class="expand" data-level="3">2级</a>
								<a href="javascript:void(0);" class="expand" data-level="4">3级</a>
								<a href="javascript:void(0);" class="expand" data-level="5">4级</a>
								<a href="javascript:void(0);" class="expand" data-level="6">5级</a>
								<a href="javascript:void(0);" class="expand" data-level="7">6级</a>
								<a href="javascript:void(0);" class="expand" data-level="8">7级</a>
								<a href="javascript:void(0);" class="expand" data-level="9">8级</a>
  							</span>
                        </div>


                        <div id="CanvasResponse" class="Canvas"></div>




                        <hr>


                        <h5>响应错误</h5>

                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                            <tr>
                                <th>错误码</th>
                                <th>提示文字</th>
                                <th>描述</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr  th:each="responseError:${api.response.errorList}">
                                <td th:text="${responseError.code}"></td>
                                <td th:text="${responseError.msg}"></td>
                                <td th:text="${responseError.description}"></td>

                            </tr>

                            </tbody>
                        </table>


                    </div>
                </div>
            </div>
        </div>

    </div>

    <!-- 全局js -->
    <script src="/js/jquery.min.js?v=2.1.4"></script>
    <script src="/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- layer javascript -->
    <script src="/js/plugins/layer/layer.min.js"></script>

    <!-- 自定义js -->
    <script src="/js/content.js?v=1.0.0"></script>
    <script src="/js/demo/layer-demo.js"></script>
    <script src="/js/jsonFormater.js"></script>

    <!--统计代码，可删除-->

</body>
<script>
    $(document).ready(function () {
        var format = function () {
            var options = {
                dom: '#Canvas',
                isCollapsible: $('#CollapsibleView').prop('checked'),
                quoteKeys: $('#QuoteKeys').prop('checked'),
                tabSize: $('#TabSize').val(),
                imgCollapsed: "/img/Collapsed.gif",
                imgExpanded: "/img/Expanded.gif",
            };
            window.jf = new JsonFormater(options);
            jf.doFormat($('#request_json').html());
        };


        var formatResponse = function () {
            var options = {
                dom: '#CanvasResponse',
                isCollapsible: $('#CollapsibleViewResponse').prop('checked'),
                quoteKeys: $('#QuoteKeysResponse').prop('checked'),
                tabSize: $('#TabSizeResponse').val(),
                imgCollapsed: "/img/Collapsed.gif",
                imgExpanded: "/img/Expanded.gif",
            };
            window.jf = new JsonFormater(options);
            jf.doFormat($('#response_json').html());
        };

        formatResponse();

        format();

        $('#format').click(function () {
            format();
        });
        $('#expandAll').click(function () {
            window.jf.expandAll();
        });
        $('#collapseAll').click(function () {
            window.jf.collapseAll();
        });

        $('#TabSize, #CollapsibleView, #QuoteKeys').change(function () {
            format();
        });


        $('.expand').click(function () {
            var level = $(this).data('level');
            window.jf.collapseLevel(level);
        });


        $('#formatResponse').click(function () {
            format();
        });
        $('#expandAllResponse').click(function () {
            window.jf.expandAll();
        });
        $('#collapseAllResponse').click(function () {
            window.jf.collapseAll();
        });

        $('#TabSizeResponse, #CollapsibleViewResponse, #QuoteKeysResponse').change(function () {
            formatResponse();
        });



    });
</script>

</html>
